    <!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="author" content="nodejh">
		<meta name="description" content="Describe your website">
		<meta name="generator" content="Hugo 0.16" />
		<title>Cannot Connet to MySql With Error Code 61 &middot; nodejh</title>
		<link rel="shortcut icon" href="http://nodejh.com/images/favicon.ico">
		<link rel="stylesheet" href="http://nodejh.com/css/style.css">
		
		<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/styles/atom-one-light.min.css">
		

		
		<link rel="stylesheet" href="http://nodejh.com/fontawesome/css/font-awesome.min.css">
		

		
		<link href="http://nodejh.com/index.xml" rel="alternate" type="application/rss+xml" title="nodejh" />
		
	</head>

    <body>
       <nav class="main-nav">
	
	
		<a href='http://nodejh.com/'> <span class="arrow">←</span>Home</a>
	

	
		<a href='http://nodejh.com/post'>Archive</a>
	

	
		<a href='http://nodejh.com/about'>About</a>
	

	
	<a class="cta" href="http://nodejh.com/index.xml">Subscribe</a>
	
</nav>


        <section id="wrapper">
            <article class="post">
                <header>
                    <h1>Cannot Connet to MySql With Error Code 61</h1>
                    <h2 class="headline">
                    Apr 7, 2016 01:55
                    · 39 words
                    · 1 minute read
                      <span class="tags">
                      
                      
                          
                              <a href="http://nodejh.com/tags/mysql">MySQL</a>
                          
                      
                      
                      </span>
                    </h2>
                </header>
                <section id="post-body">
                    <p>远程连接 MySQL 的时候出现如下错误:</p>

<pre><code>Can't connect to MySQL server on '*.*.*.*' (61)
</code></pre>

<p>这是因为 MySQL 默认的 <code>bind-address</code> 是 <code>127.0.0.1</code>, 也就是限制了只能本地访问.</p>

<p>所以解决方法之一,就是修改 <code>bind-address</code>.</p>

<p>改为 <code>0.0.0.0</code> ,任何远程 IP 都能访问.你也可以把它改为你的电脑的 IP,只能你自己访问.</p>

<p>修改后,重启就好了:</p>

<pre><code>$ sudo vim /etc/mysqlmy.cnf
# 修改 bind-address
$ sudo service mysql restart
</code></pre>

                </section>
            </article>

            <div id="disqus_thread"></div>
<div style="margin-top: 50px">
  评论: 请点击 Gtihub Issue 链接跳转到评论页面
</div>
</div>


            <footer id="footer">
    
        <div id="social">

	
	
    <a class="symbol" href="https://www.facebook.com/nodejh">
        <i class="fa fa-facebook-square"></i>
    </a>
    
    <a class="symbol" href="https://www.github.com/nodejh">
        <i class="fa fa-github"></i>
    </a>
    
    <a class="symbol" href="http://stackoverflow.com/users/4518882/nodejh">
        <i class="fa fa-stack-overflow"></i>
    </a>
    
    <a class="symbol" href="https://www.twitter.com/nodejh">
        <i class="fa fa-twitter"></i>
    </a>
    


</div>

    
    <p class="small">
    
        © Copyright 2016 <i class="fa fa-heart" aria-hidden="true"></i> nodejh
    
    </p>
</footer>

        </section>

        <script   src="https://code.jquery.com/jquery-2.2.4.js" integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="   crossorigin="anonymous"></script>
<script src="http://nodejh.com/js/main.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>




<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-84989670-1', 'auto');
ga('send', 'pageview');
</script>


    </body>
</html>
